/*
 *  $Id: Immune.cs 975 2009-12-16 17:13:22Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Affects {
    /// <summary>
    /// Эффект: иммунитет к урону
    /// Параметр: тип урона
    /// Дает иммунитет к определенному типу урона.
    /// </summary>
    public class Immune: Affect {
        public static readonly Languages.Phrase ImmuneScorchDesc = new Languages.Phrase("affect.immune.scorch.icondesc");
        public static readonly Languages.Phrase ImmuneWoundDesc = new Languages.Phrase("affect.immune.wound.icondesc");

        public DamageType DmgType;

        public Immune(DamageType type) {
            DmgType = type;
        }

        public override string Id {
            get { return "immune"; }
        }
        public override string NameText {
            get { return Name.GetText(DmgType.AffectName); }
        }

        public override int BaseWeight {
            get { return 30; }
        }

    	public override AffectIcon Icon {
            get {
                if (DmgType == DamageType.Fire) return AffectIcon.ImmuneScorch;
                if (DmgType == DamageType.Wound) return AffectIcon.ImmuneWound;
                return base.Icon;
            }
        }

        public override Languages.Phrase IconDescription {
            get {
                if (DmgType == DamageType.Fire) return ImmuneScorchDesc;
                if (DmgType == DamageType.Wound) return ImmuneWoundDesc;
                return base.IconDescription;
            }
        }

        public override Affect Clone() {
            return new Immune(DmgType);
        }

        public override void SetAffect() {
            base.SetAffect();
            LocalSummary.Immunes.Add(this);
        }
        public override void ResetAffect() {
            base.ResetAffect();
            LocalSummary.Immunes.Remove(this);
        }

        public static DamageType Getter(Immune affect) {
            return affect.DmgType;
        }
    }
}